﻿@using System.Data;
@using DTcms.Common;
@model DTcms.Model.BaseModel
@{
    ViewBag.Title = "站内搜索" + "-" + Model.site.name;
    string keyword = Model.info["keyword"].ToString();
    string tags = Model.info["tags"].ToString();
    string channel_name = Model.info["channel_name"].ToString();
    int channel_id = Utils.ObjToInt(Model.info["channel_id"]);
}
@section HeaderContent{

}
<!--当前位置-->
<div class="section">
    <div class="location">
        <span>当前位置：</span>
        <a href="@Html.linkurl("index")">首页</a> &gt;
        <a href="javascript:;">站内搜索</a>
    </div>
</div>
<!--/当前位置-->

<div class="section clearfix">
    <!--/页面右边-->
    <div class="right-260">
        <div class="bg-wrap nobg">
            <div class="sidebar-box">
                <h4>热门标签</h4>
                <div class="tags-box clearfix">
                    @{
                        DataTable tagsList = Html.get_article_tags(0, "is_red=1");
                        foreach (DataRow dr in tagsList.Rows)
                        {
                            <a href="@Html.queryurl("tags",dr["call_index"].ToString(),dr["id"].ToString())">@dr["title"]<i>(@dr["count"])</i></a>
                        }
                    }
                </div>
            </div>
            <div class="sidebar-box">
                <h4>推荐新闻</h4>
                <ul class="side-img-list">
                    @{
                        DataTable redNews = Html.get_article_list("news", 0, 4, "status=0 and is_red=1 and img_url<>''");
                        foreach (DataRow dr in redNews.Rows)
                        {
                            <li>
                                <div class="img-box">
                                    <img src="@dr["img_url"]" />
                                </div>
                                <div class="txt-box">
                                    <a href="@Html.queryurl("news_show",dr["call_index"].ToString(),dr["id"].ToString())">@dr["title"]</a>
                                    <span>@Html.datetostr(dr["add_time"], "yyyy-MM-dd")</span>
                                </div>
                            </li>
                        }
                    }
                </ul>
            </div>
        </div>
    </div>
    <!--/页面右边-->
    <!--页面左边-->
    <div class="left-auto">
        <div class="bg-wrap">
            <!--取得一个DataTable-->
            @{
                //DataTable list = Html.get_search_list(Model.site.id,channel_name,"", keyword, Model.page, Model.pagesize, out Model.totalcount);
                DataTable list = Html.get_lucene_list(channel_id, keyword, Model.page, Model.pagesize, out Model.totalcount, Model.site.id);
                if (tags != "")
                {
                    Model.pagelist = Html.get_page_link(Model.pagesize, Model.page, Model.totalcount, Html.linkurl("search", "?tags=" + Server.UrlEncode(tags) + "&page=__id__"));
                }
                else
                {
                    Model.pagelist = Html.get_page_link(Model.pagesize, Model.page, Model.totalcount, Html.linkurl("search", "?keyword=" + Server.UrlEncode(keyword) + "&page=__id__"));
                }
            }
            <div class="search-tit">
                <h3>搜索结果</h3>
                <span>@(tags != "" ? "查询Tags标签" : "搜索关健字")：<strong>@(tags != "" ? tags : keyword)</strong>，共有<strong>@Model.totalcount</strong>条记录</span>
            </div>
            <ul class="n-list" id="articlList">
                @{
                    foreach (DataRow dr in list.Rows)
                    {
                        <li>
                            <h2><a href="@dr["link_url"]">@Html.Raw(dr["title"])</a></h2>
                            <div class="note">
                                @if (dr["img_url"].ToString() != "")
                                {
                                    <b><img src="@dr["img_url"]" /></b>
                                }
                                <p>@Html.Raw(dr["zhaiyao"])</p>
                                <div class="info">
                                    <span><i class="iconfont icon-date"></i>@dr["add_time"]</span>
                                    <span><i class="iconfont icon-comment"></i><span class="b_comment tg_chrnum_@dr["id"]" data-tgid="@dr["id"]" data-tcid="@dr["channel_id"]">0</span>人评论</span>
                                    <span>
                                        <i class="iconfont icon-view"></i>
                                        @dr["click"]次浏览
                                    </span>
                                </div>
                            </div>
                        </li>
                    }
                    if (Model.totalcount == 0)
                    {
                        <div class="nodata">很抱歉，暂无查找到符合条件的信息！</div>
                    }
                }
            </ul>
            <!--页码列表-->
            <div class="page-box">
                <div class="pageNavigation">@Html.Raw(Model.pagelist)</div>
            </div>
            <!--/页码列表-->
        </div>
    </div>
    <!--/页面左边-->
</div>
@section Scripts{
    <script type="text/javascript">
        layui.use(['myaspx'], function () {
            var os = layui.myaspx;
            $('#articlList').get_comment_fech('.b_comment', '@Model.config.webpath');
        });
    </script>
}